#include <QString>
#include <unistd.h>
#include <limits.h>
#include "common.h"

QString Platform::getProcessPathByPID(unsigned long pid)
{
    char path[30];
    sprintf(path, "/proc/%ld/exe", pid);
    char buff[PATH_MAX];
    ssize_t buff_len;
    if ((buff_len = readlink(path, buff, PATH_MAX - 1)) != -1)
    {
        buff[buff_len] = '\0';
        return QString(buff);
    }
    return "";
}
